package com.hckjsec.common.init;

import com.hckjsec.common.ueditor.domain.UploadImgConfig;

import javax.annotation.Resource;
import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class YwInitData {
    private static Map<Long, String> userMap = new Hashtable<Long, String>();// 人员map
    private static Map<Long, String> deptMap = new Hashtable<Long, String>();// 部门map

    /****微信端初始化****/
    private static ConcurrentHashMap<String, Long> AppidByIdMap= new ConcurrentHashMap<String, Long>();//通过appid得到系统中id
    private static ConcurrentHashMap<Long, Object> IdByBasicViewMap= new ConcurrentHashMap<Long, Object>();//通过id得到系统中参数配置
    private static ConcurrentHashMap<Long, Object> IdByConfigViewMap= new ConcurrentHashMap<Long, Object>();//通过id得到系统中系统配置
    private static ConcurrentHashMap<Long, Object> IdByConfigStateMap= new ConcurrentHashMap<Long, Object>();//通过id得到系统中启用的一些配置
    private static ConcurrentHashMap<String, String> BusinessStateMap =  new ConcurrentHashMap<String, String>();//小程序状态
    /**百度编辑器访问URL**/
    private static String accessUrlPrefix = "";

    /**********以下为初始化数据**********/
    public void initUser(Map<Long, String> userInitMap){
        userMap.clear();
        userMap=userInitMap;
    }

    public void initDept(Map<Long, String> deptInitMap){
        deptMap.clear();
        deptMap=deptInitMap;
    }

    public void initAppidById(ConcurrentHashMap<String, Long> AppidByIdMap){
        this.AppidByIdMap.clear();
        this.AppidByIdMap=AppidByIdMap;
    }

    public void initIdByConfigView(ConcurrentHashMap<Long, Object> IdByConfigViewMap){
        this.IdByConfigViewMap.clear();
        this.IdByConfigViewMap=IdByConfigViewMap;
    }

    public void initIdByBasicView(ConcurrentHashMap<Long, Object> IdByBasicViewMap){
        this.IdByBasicViewMap.clear();
        this.IdByBasicViewMap=IdByBasicViewMap;
    }

    public void initIdByConfigState(ConcurrentHashMap<Long, Object> IdByConfigStateMap){
        this.IdByConfigStateMap.clear();
        this.IdByConfigStateMap=IdByConfigStateMap;
    }
    public void initBusinessState(ConcurrentHashMap<String, String> BusinessStateMap){
        this.BusinessStateMap.clear();
        this.BusinessStateMap=BusinessStateMap;
    }

    public void initAccessUrlPrefix(String accessUrlPrefix){
        this.accessUrlPrefix = accessUrlPrefix;
    }

    //修改appid获取id的Map
    public void modAppidById(String appid,Long id){
       this.AppidByIdMap.put(appid,id);
   }
    //修改id获取对象的Map
    public void modIdByConfig(Long id,Object object){
       this.IdByConfigViewMap.put(id,object);
   }
    //修改id获取配置参数的Map
    public void modIdByBasicView(Long id,Object object){
        this.IdByBasicViewMap.put(id,object);
    }
    //修改id获取配置参数状态的Map
    public void modIdByConfigState(Long id,Object object){
        this.IdByConfigStateMap.put(id,object);
    }


    /**********以下为取数据**********/
    public static Map<Long,String> getUserMap(){
        return userMap;
    }
    public static Map<Long,String> getDeptMap(){
        return deptMap;
    }
    public static Map<String, Long> getAppidByIdMap(){
        return AppidByIdMap;
    }
    public static Map<Long, Object> getIdByBasicViewMap(){
        return IdByBasicViewMap;
    }
    public static Map<Long, Object> getIdByConfigViewMap(){
        return IdByConfigViewMap;
    }
    public static Map<Long, Object> getIdByConfigStateMap(){
        return IdByConfigStateMap;
    }
    public static Map<String, String> getBusinessStateMap(){
        return BusinessStateMap;
    }
    public static String getAccessUrlPrefix(){
        return accessUrlPrefix;
    }
}
